package com.xf.system.exception;

/**
 * @author xiefengf
 */
public interface Errors {

    public interface Biz {
        ErrorCodeAndMessage BIZ_01001 = createBizError(1001, "异常错误");
    }

    public interface System {
        ErrorCodeAndMessage SYSTEM_01001 = createSystemError(1001, "登录账号已存在");
        ErrorCodeAndMessage SYSTEM_01002 = createSystemError(1002, "手机号码已存在");
        ErrorCodeAndMessage SYSTEM_01003 = createSystemError(1003, "邮箱账号已存在");
        ErrorCodeAndMessage SYSTEM_01004 = createSystemError(1004, "当前用户不存在");
        ErrorCodeAndMessage SYSTEM_01005 = createSystemError(1005, "旧密码输入有误");
        ErrorCodeAndMessage SYSTEM_01006 = createSystemError(1006, "部门不存在");
        ErrorCodeAndMessage SYSTEM_01007 = createSystemError(1007, "父部门已停用，不允许新增/更新");
        ErrorCodeAndMessage SYSTEM_01008 = createSystemError(1008, "部门名称已存在");
        ErrorCodeAndMessage SYSTEM_01009 = createSystemError(1009, "上级部门不能是自己");
        ErrorCodeAndMessage SYSTEM_01010 = createSystemError(1010, "当前部门下包含未停用的子部门，当前部门不能停用");
        ErrorCodeAndMessage SYSTEM_01011 = createSystemError(1011, "当前部门存在下级部门,不允许删除");
        ErrorCodeAndMessage SYSTEM_01012 = createSystemError(1012, "部门存在用户,不允许删除");
        ErrorCodeAndMessage SYSTEM_01013 = createSystemError(1013, "角色名称已存在");
        ErrorCodeAndMessage SYSTEM_01014 = createSystemError(1014, "角色权限字符串已存在");
        ErrorCodeAndMessage SYSTEM_01015 = createSystemError(1015, "角色还有对应的用户，不能删除");
        ErrorCodeAndMessage SYSTEM_01016 = createSystemError(1016, "当前角色不存在");
        ErrorCodeAndMessage SYSTEM_01017 = createSystemError(1017, "菜单不存在");
        ErrorCodeAndMessage SYSTEM_01018 = createSystemError(1018, "父菜单已停用，不允许新增/更新");
        ErrorCodeAndMessage SYSTEM_01019 = createSystemError(1019, "菜单名称已存在");
        ErrorCodeAndMessage SYSTEM_01020 = createSystemError(1020, "上级菜单不能是自己");
        ErrorCodeAndMessage SYSTEM_01021 = createSystemError(1021, "当前菜单下包含未停用的子菜单，当前菜单不能停用");
        ErrorCodeAndMessage SYSTEM_01022 = createSystemError(1022, "当前菜单存在下级菜单,不允许删除");
        ErrorCodeAndMessage SYSTEM_01023 = createSystemError(1023, "菜单存在对应的角色,不允许删除");
    }

    /**
     * 创建基础异常返回信息
     * @param messageCode 异常code
     * @param message 异常信息
     * @return 异常返回信息
     */
    static ErrorCodeAndMessage createBizError(Integer messageCode, String message) {
        String code = BaseErrorsConst.BIZ_CODE + messageCode;
        return ErrorCodeAndMessage.create(Integer.valueOf(code), message);
    }

    /**
     * 创建系统异常返回信息
     * @param messageCode 异常code
     * @param message 异常信息
     * @return 异常返回信息
     */
    static ErrorCodeAndMessage createSystemError(Integer messageCode, String message) {
        String code = BaseErrorsConst.SYS_CODE + messageCode;
        return ErrorCodeAndMessage.create(Integer.valueOf(code), message);
    }


}
